from app.libs.http_util import HTTP


class YuShuBook:
    isbn_url = 'http://t.yushu.im/v2/book/isbn/{}'
    keyword_url = 'http://t.yushu.im/v2/book/search?q={}&count={}&start={}'

    @classmethod
    def serch_by_isbn(cls,isbn):
        url=cls.isbn_url.format(isbn)
        result=HTTP.get(url)
        return result

    @classmethod
    def serch_by_keyword(cls,keyword,acount=20,start=0):
        url = cls.keyword_url.format(keyword,acount,start)
        result = HTTP.get(url)
        return result